﻿using HuiLian.Common.Input;
using HuiLian.Common.Output;
using HuiLian.Model.Platform;
using HuiLian.Service.Platform.CallTime.Input;
using HuiLian.Service.Platform.CallTime;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using HuiLian.Service.Platform.AlarmSchemeSet;
using HuiLian.Service.Platform.AlarmSchemeSet.Input;

namespace HuiLian.Web.Controllers.Platform
{
    /// <summary>
    /// 预警方案设置
    /// </summary>
    public class AlarmSchemeSetController : AreaController
    {
        private readonly IAlarmSchemeSetService _alarmSchemeSetServices;

        public AlarmSchemeSetController(IAlarmSchemeSetService alarmSchemeSetServices)
        {
            _alarmSchemeSetServices = alarmSchemeSetServices;
        }

        /// <summary>
        /// 查询单条预警方案设置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> Get(long id)
        {
            return await _alarmSchemeSetServices.GetAsync(id);
        }

        /// <summary>
        /// 查询分页预警方案设置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetPage(PageInput<AlarmSchemeSetEntity> model)
        {
            return await _alarmSchemeSetServices.PageAsync(model);
        }

        /// <summary>
        /// 新增预警方案设置
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> Add(AlarmSchemeSetAddInput input)
        {
            return await _alarmSchemeSetServices.AddAsync(input);
        }

        /// <summary>
        /// 修改预警方案设置
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IResponseOutput> Update(AlarmSchemeSetUpdateInput input)
        {
            return await _alarmSchemeSetServices.UpdateAsync(input);
        }

        /// <summary>
        /// 删除预警方案设置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<IResponseOutput> SoftDelete(long id)
        {
            return await _alarmSchemeSetServices.SoftDeleteAsync(id);
        }

        /// <summary>
        /// 批量删除预警方案设置
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
        {
            return await _alarmSchemeSetServices.BatchSoftDeleteAsync(ids);
        }
    }
}
